

<div class="bjui-pageHeader">
    <form id="pagerForm" data-toggle="ajaxsearch" action="${request.getContextPath()}/StepStatusAnalysis/stepStatusAnalysis" method="post">
        <div class="bjui-searchBar">
            <g:hiddenField name="SYS_QUERY_NAME" value="stepStatusAnalysis" />
            <g:hiddenField name="EXPORT_CONTENT_NAME" value="Excel" />
            <label>工序：</label>
            <g:select name="step" from="${stepStatusAnalysisStepList}" data-toggle="selectpicker" data-live-search="true" optionKey="step" optionValue="step" value="${step}" noSelection="['': '===ALL===']"
                      data-refurl="${request.getContextPath()}/StageWip/getOptionHTMLByTarget?step={value}&SYS_QUERY_NAME=stageWipLineIdList" data-nextselect="#stageStep"  />&nbsp;

            <button type="submit" class="btn-default" data-icon="search">查询</button>&nbsp;
            <button type="button" class="btn-blue" onclick="javascript:bjuiExportExl('#pagerForm','${request.getContextPath()}/BadProcessAnalysis/exportExcel')" data-icon="file-excel-o" title="导出Excel">导出</button>&nbsp;
        </div>
    </form>
</div>

<div class="bjui-pageContent">
    <g:if test="${stepStatusAnalysis.size() > 0}">
        <table  data-toggle="tablefixed" data-width="100%" data-nowrap="true">
            <thead>
            <tr>
                <g:each in="${tableHeadList}" status="j" var="headInstance">
                    <g:if test="${headInstance!='RN'}">
                        <th  width="125"><g:message code="${headInstance}" default="${headInstance}"/></th>
                    </g:if>
                </g:each>
            </tr>
            </thead>
            <tbody>
            <g:each in="${stepStatusAnalysis}" status="i" var="dataInstance">
                <tr>
                    <g:each in="${tableHeadList}" status="j" var="headInstance">
                        <g:if test="${headInstance=='WAIT'||headInstance=='RUN'||headInstance=='HOLD'||headInstance=='REPAIR'||headInstance=='OUTSRC'||headInstance=='HJ'}">
                            <td name="STEP${headInstance}${i}">${dataInstance["${headInstance}"] }</td>
                        </g:if>
                        <g:elseif test="${headInstance!='RN'}">
                            <td>${dataInstance["${headInstance}"] }</td>
                        </g:elseif>

                    </g:each>
                </tr>
            </g:each>
            <tr>
                <td colspan="2">小计(当前页)</td>
                <td name="stepWaitShow">0</td>
                <td name="stepRunShow">0</td>
                <td name="stepHoldShow">0</td>
                <td name="stepRepairShow">0</td>
                <td name="stepOutsrcShow">0</td>
                <td name="HJShow">0</td>
            </tr>
            <tr>
                <td colspan="2">合计(总)</td>
                <td>${stepStatusAnalysisSum[0].WAITSUM}</td>
                <td>${stepStatusAnalysisSum[0].RUN}</td>
                <td>${stepStatusAnalysisSum[0].HOLD}</td>
                <td>${stepStatusAnalysisSum[0].REPAIR}</td>
                <td>${stepStatusAnalysisSum[0].OUTSRC}</td>
                <td>${stepStatusAnalysisSum[0].HJ}</td>

            </tr>
            </tbody>
        </table>
    </g:if>
    <g:else>
        <g:render template="../template/emptyPanel" />
    </g:else>
</div>
<g:render template="../template/pagination" />
<script>
    $(function(){
        var stepWaitQty=0;
        var stepRunQty=0;
        var stepHoldQty=0;
        var stepRepairQty=0;
        var stepOutsrcQty=0;
        var HJQty=0;
        for(var i=0;i<${stepStatusAnalysis.size()};i++){

            var stepwaitqty='STEPWAIT'+i
            var stepWaitAdd=$("td[name='"+stepwaitqty+"']").text()==''?0:parseInt($("td[name='"+stepwaitqty+"']").text());
            stepWaitQty+=stepWaitAdd;

            var steprunqty='STEPRUN'+i
            var stepRunAdd=$("td[name='"+steprunqty+"']").text()==''?0:parseInt($("td[name='"+steprunqty+"']").text());

            stepRunQty+=stepRunAdd;

            var stepholdqty='STEPHOLD'+i
            var stepHoldAdd=$("td[name='"+stepholdqty+"']").text()==''?0:parseInt($("td[name='"+stepholdqty+"']").text());
            stepHoldQty+=stepHoldAdd;

            var steprepairqty='STEPREPAIR'+i
            var stepRepairAdd=$("td[name='"+steprepairqty+"']").text()==''?0:parseInt($("td[name='"+steprepairqty+"']").text());
            stepRepairQty+=stepRepairAdd;
//
            var stepoutsrcqty='STEPOUTSRC'+i
            var stepOutsrcAdd=$("td[name='"+stepoutsrcqty+"']").text()==''?0:parseInt($("td[name='"+stepoutsrcqty+"']").text());
            stepOutsrcQty+=stepOutsrcAdd;

            var HJqty='STEPHJ'+i
            var HJAdd=$("td[name='"+HJqty+"']").text()==''?0:parseInt($("td[name='"+HJqty+"']").text());
            HJQty+=HJAdd;



        }


        $("td[name='stepWaitShow']").html(stepWaitQty);
        $("td[name='stepRunShow']").html(stepRunQty);
        $("td[name='stepHoldShow']").html(stepHoldQty);
        $("td[name='stepRepairShow']").html(stepRepairQty);
        $("td[name='stepOutsrcShow']").html(stepOutsrcQty);
        $("td[name='HJShow']").html(HJQty);
    })
</script>